import java.awt.Point;
import java.awt.geom.*;

public class Tile extends Area {
	Tile _left;
	Tile _right;
	Tile _top;
	Tile _bottom;
	int _column;
	int _row;
	private Rectangle2D.Double	Square;
	private Ellipse2D.Double	Circle;
	Area Center;
	private Player _player = Player.NONE;
	
	public Tile(double _x, double _y, double _w, double _h){
		
		Square = new Rectangle2D.Double(_x,_y,_w,_h);
		Circle = new Ellipse2D.Double(_x+_w/10,_y+_h/10,_w-_w/5,_h-_h/5);
		Center = new Area(Circle);
		
		super.add(new Area(Square));
		super.subtract(Center);
	}
	
	public Player GetPlayer(){
		return _player;
	}
	
	public void SetPlayer(Player player){
		_player = player;
	}
	
	public boolean contains(Point p){
		return Square.contains(p);
	}
	
	public boolean containsX(Point p) {
		if (Square.x < p.x) {
			return (Square.x + Square.width) > p.x;
		} else {
			return false;
		}
	}
	
	public boolean containsY(Point p) {
		if (Square.y > p.y) {
			return (Square.y + Square.height) < p.y;
		} else {
			return false;
		}
	}
	
}
